package de.tabreaderandroid.tabreader.model;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * A class encapsulating the information parsed from a tab file.
 * 
 * @author André Stannek
 * 
 */
public class TabFile {

	private List<ChordedLine> chordedLines;

	private List<BarGroup> tabBars;

	private List<MetaLine> metaLines;

	private String originString;

	/**
	 * Creates a new {@link TabFile}.
	 */
	public TabFile(final String originString) {
		super();
		this.originString = originString;
		chordedLines = new ArrayList<ChordedLine>();
		tabBars = new ArrayList<BarGroup>();
		metaLines = new ArrayList<MetaLine>();
	}

	public List<ChordedLine> getChordedLines() {
		return chordedLines;
	}

	public void setChordedLines(final List<ChordedLine> chordedLines) {
		this.chordedLines = chordedLines;
	}

	public List<BarGroup> getTabBars() {
		return tabBars;
	}

	public void setTabBars(final List<BarGroup> tabLines) {
		this.tabBars = tabLines;
	}

	public List<MetaLine> getMetaLines() {
		return metaLines;
	}

	public void setMetaLines(final List<MetaLine> metaLines) {
		this.metaLines = metaLines;
	}

	public List<TabFileElement> getTabElements() {
		List<TabFileElement> result = new ArrayList<TabFileElement>();
		result.addAll(chordedLines);
		result.addAll(tabBars);
		result.addAll(metaLines);
		Collections.sort(result);
		return result;
	}

	/**
	 * @return the text as it was contained in the original tab file
	 */
	public String getOriginString() {
		return originString;
	}
}
